package com.vivo.ic.dm;

import java.io.FileOutputStream;

/**
 * 
 * @author wangzhenyu
 * 子下载数据结构
 *
 */

public class ChildDownloadInfo {
    /**
     * 下载Id,属于同一个下载的多个子线程的mDownloadId相同
     */
    protected long mDownloadId;
    /**
     * thread id
     */
    protected int mTid;
    /**
     * 下载的url
     */
    protected String mUrl;
    /**
     * 下载的开始位置
     */
    protected long mStartBytes;
    /**
     * 下载的终止位置
     */
    protected long mEndBytes;
    /**
     * 子文件块名，包括完整路径
     */
    protected String mBlockName;
    /**
     * 子文件块总大小
     */
    protected long mTotalBytes = 0;
    /**
     * 子文件块已下载大小
     */
    protected long mCurrentBytes = 0;
    /**
     * 状态位
     */
    protected int mStatus;

    protected String mErrorMsg;

    protected Exception mException;

    protected FileOutputStream mOutStream;
    
    /**
     * 下载完成
     */
    protected boolean mCompleted = false;
    /**
     * 下载速度采样时间
     */
    protected long mSpeedSampleStart;

    protected long mSpeedSampleBytes;
    /**
     * 下载速度
     */
    protected long mSpeed;

    protected long mBytesNotified;

    protected long mTimeLastNotification;

    protected boolean mResume; // 表示是断点续传

    @Override
    public String toString() {
        return "ChildDownloadInfo{" +
                "mDownloadId=" + mDownloadId +
                ", mTid=" + mTid +
                ", mUrl='" + mUrl + '\'' +
                ", mStartBytes=" + mStartBytes +
                ", mEndBytes=" + mEndBytes +
                ", mBlockName='" + mBlockName + '\'' +
                ", mTotalBytes=" + mTotalBytes +
                ", mCurrentBytes=" + mCurrentBytes +
                ", mSpeed=" + mSpeed +
                ", mStatus=" + mStatus +
                ", mResume=" + mResume +
                '}';
    }
}
